<template>
    <div>
        homechild1
        <button @click="tofatherFn">ref链</button>
    </div>
</template>

<script>

export default {
    name: 'homechild1',
    data() {
        return {

        };
    },
    methods: {
        tofatherFn() {
            // 获取组件Homechild2son的实例对象
            console.log(this.$parent.$refs.homechild2.$refs.Homechild2son);
            this.$parent.$refs.homechild2.$refs.Homechild2son.name = '张继科'
        }
    }


}

</script>
<style scoped></style>